#ifndef CalculateSunRise_h
#define CalculateSunRise_h

#include <time.h>
#include<math.h>

#define PI 3.141592653


class CalculateSunRise {
  public:
    bool bDaytime(double lon, double lat, int year, int month, int date, int hour, int minute);
  private:
    double UTo;
    double h;
    bool leap_year(int year);
    int days(int year, int month, int date);
    double t_century(int days, double uto);
    double L_sun(double t_century);
    double G_sun(double t_century);
    double ecliptic_longitude(double L_sun, double G_sun);
    double earth_tilt(double t_century);
    double sun_deviation(double earth_tilt, double ecliptic_longitude);
    double GHA(double UTo, double G_sun, double ecliptic_longitude);
    double e(double h, double glat, double sun_deviation);
    double UT_rise(double UTo, double GHA, double glong, double e);
    double UT_set(double UTo, double GHA, double glong, double e);
    double result_rise(double UT, double UTo, double glong, double glat, int year, int month, int date);
    double result_set(double UT, double UTo, double glong, double glat, int year, int month, int date);
    struct SunRiseSetHourMin getSunrise(double longitude, double latitude, int year, int month, int date);
    struct SunRiseSetHourMin getSunset(double longitude, double latitude, int year, int month, int date);
    void initClass();
};

#endif